this._notDisplayedResult = [];
this._terms = [];
+
+ this.actor = new St.BoxLayout({ style_class: 'search-section',
+ vertical: true });
+
+ this._resultDisplayBin = new St.Bin({ x_fill: true,
+ y_fill: true });
+ this.actor.add(this._resultDisplayBin, { expand: true });
+
+ let separator = new Separator.HorizontalSeparator({ style_class: 'search-section-separator' });
+ this.actor.add(separator.actor);
+ },
+
+ _clearResultDisplay: function() {
+ },
+
+ clear: function() {
+ this._clearResultDisplay();
+ this.actor.hide();
},
hasMoreResults: function() {
updateSearch: function(providerResults, terms, callback) {
this.setResults(providerResults, terms);
if (providerResults.length == 0) {
- this.clear();
+ this._clearResultDisplay();
+ this.actor.hide();
callback();
} else {
let results = this.getResultsForDisplay();
// the first search result stays the same, we hide the
// content while filling in the results.
this.actor.hide();
+ this._clearResultDisplay();
this._renderResults(metas);
this._setMoreIconVisible(this.hasMoreResults() && this.provider.canLaunchSearch);
this.actor.show();
_init: function(provider) {
this.parent(provider);
- this.actor = new St.BoxLayout({ style_class: 'search-section-content' });
+ this._container = new St.BoxLayout({ style_class: 'search-section-content' });
this.providerIcon = new ProviderIcon(provider);
this.providerIcon.connect('clicked', Lang.bind(this,
function() {
Main.overview.toggle();
}));
- this.actor.add(this.providerIcon, { x_fill: false,
- y_fill: false,
- x_align: St.Align.START,
- y_align: St.Align.START });
+ this._container.add(this.providerIcon, { x_fill: false,
+ y_fill: false,
+ x_align: St.Align.START,
+ y_align: St.Align.START });
this._content = new St.BoxLayout({ style_class: 'list-search-results',
vertical: true });
- this.actor.add(this._content, { expand: true });
+ this._container.add(this._content, { expand: true });
+
+ this._resultDisplayBin.set_child(this._container);
},
_setMoreIconVisible: function(visible) {
}
},
- clear: function () {
+ _clearResultDisplay: function () {
this._content.destroy_all_children();
},
this._grid = new IconGrid.IconGrid({ rowLimit: MAX_GRID_SEARCH_RESULTS_ROWS,
xAlign: St.Align.START });
- this.actor = new St.Bin({ x_align: St.Align.MIDDLE });
+ this._bin = new St.Bin({ x_align: St.Align.MIDDLE });
+ this._bin.set_child(this._grid.actor);
- this.actor.set_child(this._grid.actor);
+ this._resultDisplayBin.set_child(this._bin);
},
getResultsForDisplay: function() {
- let canDisplay = this._grid.childrenInRow(this.actor.width) * this._grid.getRowLimit();
+ let canDisplay = this._grid.childrenInRow(this._bin.width) * this._grid.getRowLimit();
let newResults = this._notDisplayedResult.splice(0, canDisplay);
return newResults;
},
}
},
- clear: function () {
+ _clearResultDisplay: function () {
this._grid.removeAll();
},
},
createProviderMeta: function(provider) {
- let providerBox = new St.BoxLayout({ style_class: 'search-section',
- vertical: true });
let resultDisplay = null;
if (provider.appInfo) {
providerBox.add(separator.actor);
this._providerMeta.push({ provider: provider,
- actor: providerBox,
resultDisplay: resultDisplay });
- this._content.add(providerBox);
+ this._content.add(resultDisplay.actor);
},
destroyProviderMeta: function(provider) {
for (let i=0; i < this._providerMeta.length; i++) {
let meta = this._providerMeta[i];
if (meta.provider == provider) {
- meta.actor.destroy();
+ meta.resultDisplay.actor.destroy();
this._providerMeta.splice(i, 1);
break;
}
for (let i = 0; i < this._providerMeta.length; i++) {
let meta = this._providerMeta[i];
meta.resultDisplay.clear();
- meta.actor.hide();
}
},
for (let i = 0; i < this._providerMeta.length; i++) {
let meta = this._providerMeta[i];
- if (!meta.actor.visible)
+ if (!meta.resultDisplay.actor.visible)
continue;
let firstResult = meta.resultDisplay.getFirstResult();
let [provider, providerResults] = results;
let meta = this._metaForProvider(provider);
- meta.actor.visible = providerResults.length > 0;
meta.resultDisplay.updateSearch(providerResults, terms, Lang.bind(this, function() {
this._maybeSetInitialSelection();
this._updateStatusText();